package com.ruoyi.web.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.web.domain.Trajectory;
import com.ruoyi.web.mapper.TrajectoryMapper;
import com.ruoyi.web.service.ITrajectoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 轨迹信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-19
 */
@Service
public class TrajectoryServiceImpl extends ServiceImpl<TrajectoryMapper, Trajectory> implements ITrajectoryService {
    @Autowired
    private TrajectoryMapper trajectoryMapper;

    /**
     * 查询轨迹信息
     * 
     * @param id 轨迹信息主键
     * @return 轨迹信息
     */
    @Override
    public Trajectory selectTrajectoryById(Long id)
    {
        return trajectoryMapper.selectTrajectoryById(id);
    }

    /**
     * 查询轨迹信息列表
     * 
     * @param trajectory 轨迹信息
     * @return 轨迹信息
     */
    @Override
    public List<Trajectory> selectTrajectoryList(Trajectory trajectory)
    {
        return trajectoryMapper.selectTrajectoryList(trajectory);
    }

    /**
     * 新增轨迹信息
     * 
     * @param trajectory 轨迹信息
     * @return 结果
     */
    @Override
    public int insertTrajectory(Trajectory trajectory)
    {
        return trajectoryMapper.insertTrajectory(trajectory);
    }

    /**
     * 修改轨迹信息
     * 
     * @param trajectory 轨迹信息
     * @return 结果
     */
    @Override
    public int updateTrajectory(Trajectory trajectory)
    {
        return trajectoryMapper.updateTrajectory(trajectory);
    }

    /**
     * 批量删除轨迹信息
     * 
     * @param ids 需要删除的轨迹信息主键
     * @return 结果
     */
    @Override
    public int deleteTrajectoryByIds(Long[] ids)
    {
        return trajectoryMapper.deleteTrajectoryByIds(ids);
    }

    /**
     * 删除轨迹信息信息
     * 
     * @param id 轨迹信息主键
     * @return 结果
     */
    @Override
    public int deleteTrajectoryById(Long id)
    {
        return trajectoryMapper.deleteTrajectoryById(id);
    }

    /**
     * 根据订单号查询轨迹信息
     */
    @Override
    public List<Trajectory> getByOrderNo(String orderNo) {
        //List<Trajectory> list =  trajectoryMapper.getByOrderNo(orderNo);
        List<Trajectory> list =  this.lambdaQuery().eq(StrUtil.isNotBlank(orderNo),Trajectory::getOrderNo,orderNo).list();
        return list;
    }
}
